package java44th.group.controller.wx.gooods;

import java44th.group.bean.admin.vo.BaseRespVo;
import java44th.group.bean.common.BasePageInfo;
import java44th.group.service.wx.goods.WxGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName: project-second
 * @package: java44th.group.controller.wx.gooods
 * @className: GoodsController
 * @author: 杨浩祥
 * @description: TODO
 * @date: 2022/10/14 19:54
 * @version: 1.0
 */
@RestController
@RequestMapping("wx/goods")
public class WxGoodsController {

    @Autowired
    WxGoodsService goodsService;

    @GetMapping("count")
    public BaseRespVo count(){
        BaseRespVo baseRespVo = goodsService.count();
        return baseRespVo;
    }


    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info,Integer categoryId,String keyword){
        // http://182.92.235.201:8083/wx/goods/list?categoryId=1008008&page=1&limit=10
        BaseRespVo baseRespVo = goodsService.list(info,categoryId,keyword);
        return baseRespVo;
    }

    @GetMapping("category")
    public BaseRespVo category(Integer id){
        BaseRespVo baseRespVo = goodsService.category(id);
        return baseRespVo;
    }

    @GetMapping("detail")
    public BaseRespVo detail(Integer id){
        BaseRespVo baseRespVo = goodsService.detail(id);
        return baseRespVo;
    }

    @GetMapping("related")
    public BaseRespVo related(Integer id){
        BaseRespVo baseRespVo = goodsService.related(id);
        return baseRespVo;
    }
}
